home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / sysdeps / unix / configure < prev    next >
Text File  |  1994-02-18  |  4KB  |  122 lines

  1. # Copyright (C) 1993, 1994 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License
  6. # as published by the Free Software Foundation; either version 2 of
  7. # the License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. # configure fragment for Unix-based systems.
  20. # This file is sourced by the top-level configure script.  Note that we use
  21. # the prefix `unix_' on all shell variables here, to avoid conflicting with
  22. # any variables the top-level script might be using.
  23.  
  24. sysincludedir=/usr/include # XXX
  25.  
  26. # Find the <syscall.h> file we will be using, or something like it.
  27. unix_found=
  28. for unix_dir in $sysnames; do
  29.   if [ -r $sysdep_dir/$unix_dir/syscall.h ]; then
  30.     unix_found=$unix_dir
  31.     break
  32.   fi
  33. done
  34. if [ $unix_found = stub ]; then
  35.   # XXX This list of possibilities duplicates the list in Makefile.
  36.   for try in sys.s sys/sys.s sys.S sys/sys.S syscall.h sys/syscall.h; do
  37.     if [ -r $sysincludedir/$try ]; then
  38.       unix_syscall_h=$sysincludedir/$try
  39.       break
  40.     fi
  41.   done
  42. else
  43.   unix_syscall_h=$sysdep_dir/$unix_dir/syscall.h
  44. fi
  45.  
  46. test -n "$unix_syscall_h" && {
  47.  
  48. # Where to put the .S files we write.
  49. if [ "`pwd`" = "`(cd $srcdir; pwd)`" ]; then
  50.   unix_generated_dirpfx=sysdeps/unix/
  51. else
  52.   # We are running in a separate build directory.
  53.   unix_generated_dirpfx=
  54. fi
  55.  
  56. # This variable will collect the names of the files we create.
  57. unix_generated=
  58.  
  59. # These several functions are system calls on Unix systems which have them.
  60. # The details of these calls are universal enough that if a system's
  61. # <syscall.h> defines the system call number, we know that the simple
  62. # system call implementations in unix/common will be sufficient.
  63.  
  64. for unix_function in \
  65.   __dup2 __lstat __mkdir __rmdir __readlink __symlink rename swapon \
  66.   __access __select __getgroups/__getgrps setgroups \
  67.   __getitimer/__getitmr __setitimer/__setitmr
  68. do
  69.  
  70.   # $unix_function  =>    $unix_syscall        $unix_srcname
  71.   #    CALL            CALL            CALL
  72.   #    __CALL            CALL            __CALL
  73.   #    __CALL/NAME        CALL            NAME
  74.   unix_srcname=
  75.   eval "unix_syscall=`echo $unix_function | \
  76.                sed -e '/^__/s/^__//' \
  77.                -e 's@/\(.*\)$@ unix_srcname=\1@'`"
  78.   test -z "$unix_srcname" && unix_srcname=$unix_function
  79.  
  80.   unix_implementor=none
  81.   for unix_dir in $sysnames; do
  82.     if [ -r $sysdep_dir/$unix_dir/${unix_srcname}.c -o \
  83.          -r $sysdep_dir/$unix_dir/${unix_srcname}.S -o \
  84.      -r $sysdep_dir/$unix_dir/${unix_srcname}.s ]; then
  85.       unix_implementor=$unix_dir
  86.       break
  87.     fi
  88.   done
  89.  
  90.   # mkdir and rmdir have implementations in unix/sysv, but
  91.   # the simple syscall versions are preferable if available.
  92.   test $unix_syscall = mkdir -o $unix_syscall = rmdir && \
  93.   test $unix_implementor = unix/sysv && \
  94.     unix_implementor=generic
  95.  
  96.   case $unix_implementor in
  97.   none|stub|generic|posix)
  98.     # The chosen implementation of ${unix_syscall} is a boring one.
  99.     # We want to use the unix/common implementation instead iff
  100.     # ${unix_syscall} appears in <syscall.h>.
  101.     echo checking for ${unix_syscall} system call
  102.     if grep -i "[     _]${unix_syscall}[     ]" $unix_syscall_h >/dev/null
  103.     then
  104.       # It does seem to be present in <syscall.h>.
  105.       echo "#include <sysdeps/unix/common/${unix_srcname}.S>" \
  106.       > ${unix_generated_dirpfx}${unix_srcname}.S
  107.       test -n "$verbose" &&
  108.         echo "    wrote ${unix_generated_dirpfx}${unix_srcname}.S"
  109.       unix_generated="$unix_generated $unix_generated_dirpfx${unix_srcname}.S"
  110.     fi
  111.   ;;
  112.   *) ;;
  113.   esac
  114.  
  115. done
  116.  
  117. # Store the list of files we created in config.make; Makefile uses it.
  118. test -n "$unix_generated" && config_vars="$config_vars
  119. unix-generated := \$(addprefix $(objpfx),${unix_generated})"
  120.  
  121. }
  122.